<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>魏有仪 计数器</title>
		<script type="text/javascript" src="./vue.js">
			
		</script>
	</head>
	<body>
		<div id="app">
			<button type="button" @click="reduce">-</button>
			<h2>{{start}}</h2>
			<button type="button" @click="plu">+</button>
		</div>
		
		<script type="text/javascript">
			var app = new Vue({
				el:"#app",
				data:{
					start:1
				},
				methods:{
					// that = this.start;
					reduce:function(){
						
						if(this.start <= 1 ){
							alert("最小");
							
						}else
						{this.start--;
						console.log(this.start);}
					},
					plu:function(){
						if(this.start >= 10 ){
							alert("最大");
						}else
						{this.start++;}
						console.log(this.start);
					}
				}
			});
		</script>
	</body>
</html>
